package com.justonetech.translation.manager;

import com.justonetech.translation.daoservice.DocumentService;
import com.justonetech.translation.daoservice.ProjectService;
import com.justonetech.translation.domain.Bill;
import com.justonetech.translation.domain.BillDetail;
import com.justonetech.translation.domain.Document;
import com.justonetech.translation.domain.Project;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created with IntelliJ IDEA.
 * User: dell
 * Date: 12-7-11
 * Time: 下午1:45
 * To change this template use File | Settings | File Templates.
 */
@Service
public class ProjectManager {
    @Autowired
    private ProjectService projectService;

    @Autowired
    private DocumentService documentService;

    /**
     * 保存项目和文档信息
     *
     * @param bean
     */
    public void save(Project bean) {
        Document document = new Document();
        document.setCode(bean.getCode());
        document.setPath(bean.getName());
        documentService.save(document);

        bean.setDoc(document);
        projectService.save(bean);
    }
}
